gh-154874: Fix the sign of curses.termattrs() - #154875
Conversation
termattrs() returns a chtype mask, but it was routed through an int, so a terminal that advertises A_ITALIC came back negative and the result could no longer be passed to the attribute functions.
|
Thanks @fedonman for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
|
Thanks @fedonman for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
|
Thanks @fedonman for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.15. |
|
Sorry, @fedonman and @serhiy-storchaka, I could not cleanly backport this to |
|
Sorry, @fedonman and @serhiy-storchaka, I could not cleanly backport this to |
|
Sorry, @fedonman and @serhiy-storchaka, I could not cleanly backport this to |
termattrs()returns achtypemask, but GH-134327 routed it through anintto checkfor
ERR. On a terminal that advertisesA_ITALIC, the topmost bit of a 32-bit mask,the result comes back negative and the attribute functions reject it:
It now returns the mask unsigned, the same way
getattrs(),slk_attr()andterm_attrs()already do.baudrate(), the macro's only other user, really does returna status, so it keeps the
ERRcheck.The test drives
newterm('xterm-256color')over a pseudo-terminal rather than using$TERM, which on CI is usuallylinuxand advertises no italic, so a signed resultwould slip through. It fails without the change.
3.15 has the same bug, so this needs a backport. 3.14 is fine.